<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Select</title>

    <script type="text/javascript">
        //<![CDATA[
        function catchEvent(eventObj, event, eventHandler) {
            if (eventObj.addEventListener) {
                eventObj.addEventListener(event, eventHandler, false);
            }
            else if (event.attachEvent) {
                event = "on" + event;
                eventObj.attachEvent(event, eventHandler);
            }
        }

        function cancelEvent(event) {
            if (event.preventDefault) {
                event.preventDefault();
                event.stopPropagation();
            }
            else {
                event.returnValue = false;
                event.cancelBubble = true;
            }
        }

        catchEvent(window, "load", setupEvent);

        function setupEvent(evnt) {
            catchEvent(document.getElementById("someForm"), "submit", checkForm);
        }

        function checkForm(evnt) {
            var theEvent = evnt ? evnt : windows.event;

            // var opts = document.getElementById("someForm").selectOpts.options;
            var opts = document.getElementById("selecOpts").options;

            for(var i=0; i<opts.length; i++) {
                if(opts[i].selected) {
                    switch(opts[i].value) {
                        case "Opt1" : opts[i+1].selected = true;
                                    break;
                        case "Opt3" : opts[i+1].selected = true;
                                    break;
                        case "Opt4" : opts[i+1].selected = true;
                                    break;
                    }
                }
            }

            cancelEvent(theEvent);
        }
        
        //]]>
    </script>
</head>
<body>
    <form id="someForm" action="">
        <p>
            <select id="selecOpts" multiple="multiple">
                <option value="Opt1">Option One</option>
                <option value="Opt1a">---Option OneA</option>
                <option value="Opt2">Option Two</option>
                <option value="Opt3">Option Three</option>
                <option value="Opt3a">---Option ThreeA</option>
                <option value="Opt4">Option Four</option>
                <option value="Opt4a">Option FourA</option>
                <option value="Opt5">Option Five</option>
            </select>
            <input type="submit" value="Submit">
        </p>
    </form>
</body>
</html>
